MuleSoft Accelerator for Salesforce B2C Commerce Cloud
Use case 2 - Inventory
Overview
The following use case is covered:
- Inventory (B2C Commerce <- SAP)
On a scheduled basis (which is configurable), this use case shows you how to build the inventory list and push it into B2C Commerce.
High-level architecture
Workflow
Here is how it works:
- A scheduled event (which is configurable) is triggered in the Inventory process API for more information.
- Through the SAP system API, the inventory process API queries the inventory list and checks if it was created or updated since the last run from SAP.
- For each of the returned inventory items, data is then sent into the production environment of B2C Commerce.
Sequence diagram
Systems involved:
- ERP System: Contains information about inventory and specific plant locations. SAP is accessed via the ERP system API.
- B2C Commerce: Mule publishes inventory information into B2C Commerce in the store inventory list.
Setup instructions
SAP configuration
Follow the Custom BAPI setup instructions.
Mule projects
Follow the readme instructions of the following Mule application projects to set up and deploy the projects into Anypoint Platform for this use case.
Configurable Properties in the YAML file
Name | Value |
---|---|
jobs.** | properties for the "Jobs" object store. This OS stores the timestamp watermark for each unique job e.g. "inventory". |
inventory.** | properties for the inventory job/schedule. |
- SAP System API | API Specification | Implementation Template
Configurable Properties in the YAML file
Name | Value |
---|---|
sap.ivmaxrows | number of rows returned from the SAP BAPI function execution. |
sap.bapi | How inventory records are fetched from the specific BAPI function in SAP |
- B2C Commerce System API | API Specification | Implementation Template
- Inventory Process API | API Specification | Implementation Template
Configurable Properties in the YAML file
Name | Value |
---|---|
aggregator.size | number of inventory records that Mule should send to B2C Commerce in a single request. B2C Commerce constrains this to a maximum of 50. |
Sap-plant | map the sap plant Id's from SAP to Inventory list configured in B2C Commerce. |
inv-list | configure the reverse mapping of inventory list to SAP plant Id. |
Execution:
- Perform goods movement in SAP.
- Create new Inventory Lists in B2C Commerce.
- Map the sap-plant to inv-list inside "Inventory Process API" properties.
- Run the "Inventory Process API".
- Schedules-> Inventory -> Run Now
- Check that the B2C Commerce Inventory lists created in step 2 are filled with the new material stock.
B2C Commerce components & configurations:
- Create the appropriate inventory list in B2C Commerce where the inventory information should be sent.
- Batch
- InventoryLists resource
SAP components & configurations
BAPI exposing the inventory information
Data elements
Element Name | Data Type | Description |
---|---|---|
allocation | Decimal | The allocation quantity and reset date. |
ats | Decimal | The quantity of items available to sell (ATS). This is calculated as the allocation plus the preorderBackorderAllocation minus the turnover. |
creation_date | Date | Returns the value of attribute 'creationDate'. |
inventory_list_id | String | The user supplied ID of the inventory list. |
product_id | String | The user supplied ID of the product. |
product_name | String | The name of the product. |
stock_level | Decimal | The current stock level. This is calculated as the allocation minus the turnover. |